<?php

include(dirname(__FILE__).'/../../bootstrap/functional.php');

$browser = new BlogTestFunctional(new sfBrowser());
$browser->setTester('doctrine', 'sfTesterDoctrine');
$browser->loadFixtures();
$browser->
  get('/fr/blog/abcdefg1234/unsuscribe')->
  
  with('request')->begin()->
    isParameter('module', 'blog')->
    isParameter('action', 'unsuscribe')->
  end()->
  
  with('response')->isValid(true)->
  with('doctrine')->check('BlogPostSubscription', array('token' => 'abcdefg1234'), 0)->
  
  get('/fr/blog/faketoken/unsuscribe')->
  
  with('response')->isStatusCode(404)
;